package com.future.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.future.domain.User;
import com.future.domain.vo.StudentBackEndVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;

@Mapper
public interface AdminMapper extends BaseMapper<User>{

    /**
     * 获取班级学生列表
     * @param classId 班级ID
     * @return 学生列表
     */
    @Select("SELECT u.* FROM user u JOIN user_class uc ON u.id = uc.user_id WHERE uc.class_id = #{classId}")
    List<User> getClassStudents(Long classId);
    
    /**
     * 分页查询所有学生
     * @param page 分页对象
     * @return 分页学生列表
     */
    Page<StudentBackEndVO> selectStudentsPage(Page<User> page);
    
    @Select("SELECT class_id FROM user_class WHERE user_id = #{userId}")
    Long getClassIdByUserId(Long userId);

    @Select("SELECT id FROM class WHERE teacher_id = #{userId}")
    List<Long> getClassIdByTeacherId(Long userId);
}


